package com.fanjun.learning.multithread.Read_Write_Lock_Pattern;


public class ReaderThread extends Thread{

    private final Data data;

    public ReaderThread(Data data) {
        this.data = data;
    }

    @Override
    public void run(){
        try {
            while (true){
                char[] buffer = data.read();
                System.out.println(Thread.currentThread().getName() + "reads" + String.valueOf(buffer));
            }
        }catch (Exception ex){
            ex.printStackTrace();
        }
    }

}
